<template>
<div>
  <!-- <el-button type="primary"  @click="onSubmit">添加</el-button>dialogFormVisible = true -->
  <el-button class="btn" type="primary" @click="onAdd">添加</el-button>
  <v-list :obj="obj" :tableData1="tableData1" @refresh="refresh" @change="change"></v-list>
  <v-form :obj="obj" @refresh="refresh" ref="addarr"></v-form>
</div>
</template>

<script>
import vForm from "./components/form.vue"
import vList from "./components/list.vue"
import {reqMenuList} from "../../request/api.js"
export default {
  data(){
    return {
      tableData1:[],
      obj:{
        isshow: false,
        isadd: true,
      }
    }
  },
  components:{vForm,vList},
  methods:{
    onAdd(){
      this.obj.isshow=true
      this.obj.isadd=true
      this.$refs.addarr.addarr()
    },
    // 刷新请数据
    refresh(){
      reqMenuList({istree:true}).then(res=>{this.tableData1=res.data.list})},
    // 让form请求一条数据
    change(id){
      this.$refs.addarr.change(id)
    }
  },
  mounted(){
    this.refresh()
  }
};
</script>

<style>
</style>